package com.example.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.po.Fmeditem;
import com.example.service.FmeditemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/fmeditem")
public class FmeditemController {
    @Autowired
    private FmeditemService fmeditemService;

    @RequestMapping("/list")
    public List<Fmeditem> getAll() {
        return fmeditemService.list();
    }

    @RequestMapping("/getbyname")
    public List<Fmeditem> getByName(@RequestParam String itemname) {
        QueryWrapper<Fmeditem> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("ItemName",itemname);
        return fmeditemService.list(queryWrapper);
    }
}
